
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body,div,ul{ margin: 0; padding: 0;}
ul{ border: 1px seagreen solid}
</style>
</head>
<body>

        <div id="result"></div>

        <script >
        document.addEventListener('paste', function (e) {
            console.info(e);
            var cbd = e.clipboardData;
                var fr = new FileReader();
                var html = '';
                for(var i = 0; i < cbd.items.length; i++) {
                    var item = cbd.items[i];
                    console.info(item);
                    if(item.kind == "file"){
                        var blob = item.getAsFile();
                        if (blob.size === 0) {
                            return;
                        }
                        console.info(blob);
                        fr.readAsDataURL(blob);
                        fr.onload=function(e){
                            var result=document.getElementById("result");
                            //显示文件
                            result.innerHTML=result.innerHTML+'<ul><img src="' + this.result +'" alt="" /></ul>';
                        }
                    }
                }
        });
        </script>
</body>
</html>
